package org.generic.test03;

import java.util.HashMap;
import java.util.HashSet;

/**
 * @author CSY
 * @date 2025 - 03 - 16
 */
public class Work01 {
    public static void main(String[] args) {
        Students s1 = new Students("zs","男",20);
        Students s2 = new Students("ls","女",20);
        Students s3 = new Students("ww","男",20);

        HashSet<Students> setStus = new HashSet<Students>();
        setStus.add(s1);
        setStus.add(s2);
        setStus.add(s3);

        for (Students stu : setStus) {
            System.out.println(stu.getName());
        }

        HashMap<String,Students> mapStus = new HashMap<String,Students>();
        mapStus.put(s1.getName(),s1);
        mapStus.put(s2.getName(),s2);
        mapStus.put(s3.getName(),s3);
        for (Students s : mapStus.values()){
            System.out.println(s.getName());
        }

    }
}

class Students{
    String name;
    String sex;
    int age;

    public Students() {
    }

    public Students(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
